﻿using iMES.Entity.DomainModels;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
using System.Threading.Tasks;
using System;
using YUN.ProductionManage.IServices;

namespace iMES.WebApi.Cloudsian
{
    public partial class ProductionOrderInfoListController
    {
        private readonly IProduct_ProductOrderListService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public ProductionOrderInfoListController(
            IProduct_ProductOrderListService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }

        /// <summary>
        /// 获取订单明细
        /// </summary>
        /// <returns></returns>
        [Route("getOrderDetailsByIdAsync"), HttpGet]
        [AllowAnonymous]
        public async Task<List<OrderProductList>> GetOrderDetailsByIdAsync(Guid productionOrderId)
        {
            // 调用服务层方法获取订单明细
            var details = await _service.GetOrderDetailsByIdAsync(productionOrderId);

            return details;
        }
    }
}
